<template>
	<MkDrawer ref="mkDrawerRef" @submit="submitFn" v-model:isEdit="isEdit">
		<MkCardForm>
		
				<MkInput v-model="form.code" label="套餐代码" :isEdit="isEdit" />
				<MkInput v-model="form.name" label="套餐名称" :isEdit="isEdit" />
				<MkInput v-model="form.price" label="价格" :isEdit="isEdit" />
				<MkInput v-model="form.hisCode" label="套餐his收费编码" :isEdit="isEdit" />
				<MkSelect v-model="form.type" label="套餐类型" :isEdit="isEdit" />
				<MkSelect v-model="form.group" label="套餐分组" :isEdit="isEdit" />
				<MkInput v-model="form.paramDesc" label="检验结果时限/分" :isEdit="isEdit" />
				<MkInput v-model="form.paramDesc" label="超时提醒时间/分" :isEdit="isEdit" />
				<MkInput v-model="form.paramDesc" label="标本签收标识色" :isEdit="isEdit" />

				<MkInput v-model="form.paramDesc" label="参数说明" :isEdit="isEdit" />

		
				<el-form-item label="审核是否自动签名" :isEdit="isEdit">
					<el-switch v-model="form.autoSign" size="large" active-text="是" inactive-text="否" />
				</el-form-item>
				<el-form-item label="是否启用" :isEdit="isEdit">
					<el-switch v-model="form.isEnabled" size="large" active-text="启用" inactive-text="禁用" />
				</el-form-item>
		
		</MkCardForm>
		<MkButtonAdd size="large" @click="handleAdd" />
		<MkTable height="600px">
			<el-table-column label="检验名称" prop="name" />
			<el-table-column label="项目代码" prop="code" />
			<el-table-column label="检验代码" prop="code" />
			<el-table-column label="参考范围" prop="code" />
			<el-table-column label="单位" prop="code" />
			<el-table-column label="默认值" prop="code" />
			<el-table-column label="枚举Type" prop="code" />
			<MkColumnIsEnabled />
		</MkTable>


	</MkDrawer>
</template>
<script lang='ts' setup>
import { useEditScripts } from '/@/hooks/useEditScripts'
import { ElMessage } from 'element-plus'
/**
 * 表单数据
 */
const form = ref({
	code: '',
	name: '',
	price: '',
	hisCode: '',
	type: '',
	group: '',
	paramDesc: '',
	autoSign: false,
	isEnabled: false,
});

// emits
const emits = defineEmits(['onSuccess','returnData']);

const {
	isEdit,
	openDrawerFn,
	closeDrawerFn,
	mkDrawerRef,
	// submitFn
} = useEditScripts<any>()
//数据赋值
const DataAssignment = (row: any) => {
	if (row) {
		form.value = JSON.parse(JSON.stringify(row))
	}
};
//修改页确定后，关弹框，DisplayData方法返回假数据更新list列表
const submitFn = () =>{
	ElMessage({
    message: '保存成功',
    type: 'success',
  })
	isEdit.value = false
	closeDrawerFn()
	DisplayData()
}
//修改后的数据
const DisplayData = ()=>{
	emits('returnData',form)
}
onMounted(() => {

})

defineExpose({
	openDrawerFn, closeDrawerFn,DataAssignment
})


</script>